home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Online / AmigaTalk / intuition / Boopsi.st < prev    next >
Text File  |  2002-05-05  |  7KB  |  172 lines

  1. " -------------------------------------------------------------------- "
  2. " The Boopsi Class implements the AmigaTalk to BOOPSI functions.       "
  3. " I'm NOT going to document how existing BOOPSI classes are imple-     "
  4. " mented, you'll have to find that information from someone else!      "
  5. ""
  6. " See BOOPSIComms.st & BOOPSIMethodIDs.st for special tags used by the "
  7. " BOOPSI system & look at BoopsiClassNames.st                          "
  8. " -------------------------------------------------------------------- "
  9.  
  10. Class Boopsi :Object ! private rastPortObj iclassObj !
  11. [
  12.    dispose 
  13.       " You eventually free the object using this method: "
  14.       <primitive 238 0 private>.
  15.  
  16.       private <- nil.
  17.  
  18.       ^ nil
  19. |      
  20.    newBoopsiObject: classIDString in: iclassObject tags: tagArray
  21.       " This is the general method of creating objects from 'boopsi' classes.
  22.       * ('Boopsi' stands for basic object-oriented programming system for
  23.       * Intuition.)
  24.       * 
  25.       * You specify a class either as iclassObject (for a private class) or
  26.       * by its ID string (for public classes).  If iclassObject is nil,
  27.       * then the classID is used.  (See BoopsiClassNames.st)
  28.       * 
  29.       * You further specify initial 'create-time' attributes for the
  30.       * object via a TagItem list, and they are applied to the resulting
  31.       * generic data object that is returned.  The attributes, their meanings,
  32.       * attributes applied only at create-time, and required attributes
  33.       * are all defined and documented on a class-by-class basis.
  34.       *
  35.       * RETURNS
  36.       * A boopsi object, which may be used in different contexts such
  37.       * as a gadget or image, and may be manipulated by generic functions.
  38.       * You eventually free the object using the dispose method.
  39.       "
  40.       ^ private <- <primitive 238 1 iclassObject classIDString tagArray>
  41. |      
  42.    xxxAddBoopsiClass
  43.       " You don't need to call this method, makeBoopsiClass:for:id:size:flags: 
  44.       * will take care of it for you!
  45.       "
  46.       <primitive 238 2 iclassObj>
  47. |      
  48.    removeBoopsiClass
  49.       " Makes a public class unavailable for public consumption.
  50.       * It's OK to call this function for a class which is not
  51.       * yet in the internal public class list, or has been
  52.       * already removed.
  53.       "
  54.       <primitive 238 3 iclassObj>
  55. |      
  56.    freeBoopsiClass ! success !
  57.       success   <- <primitive 238 4 iclassObj>.
  58.       
  59.       iclassObj <- nil. " Too late!  It's all gone! "
  60.       
  61.       ^ success         " Returns true if successful "
  62. |      
  63.    makeBoopsiClass: classID for: superClassObj id: superClassID size: size flags: flags
  64.       " Make your own BOOPSI Class.  classID & superClassID can be nil,
  65.       * (which indicates a private BOOPSI Class).  superClassObj
  66.       * should NEVER be nil.  size is the size of the instance data
  67.       * that your class's objects will require, beyond that data defined 
  68.       * for your superclass's objects.  flags should be zero for now 
  69.       * (unless you KNOW otherwise): 
  70.       "
  71.       iclassObj <- <primitive 238 5 classID superClassID superClassObj size flags>.
  72.  
  73.       self xxxAddBoopsiClass.
  74.  
  75.       ^ iclassObj
  76. |
  77.    obtainGIRPort: gadgetInfoObject  
  78.       " Sets up a RastPort for use (only) by custom gadget hook routines.
  79.       * This function must be called EACH time a hook routine needing
  80.       * to perform gadget rendering is called, and must be accompanied
  81.       * by a corresponding call to releaseGIRPort.
  82.       *
  83.       * Note that if a hook function passes you a RastPort pointer,
  84.       * e.g., GM_RENDER, you needn't call obtainGIRPort in that case.
  85.       "
  86.       ^ rastPortObj <- <primitive 238 6 gadgetInfoObject>
  87. |
  88.    releaseGIRPort
  89.       " Release a custom gadget RastPort Object from obtainGIRPort: "
  90.       <primitive 238 7 rastPortObj>
  91. |
  92.    getAttribute: attrID from: object into: storageObj
  93.       ^ <primitive 238 8 attrID object storageObj>
  94. |
  95.    setAttributes: anObject tags: tagArray 
  96.       " Specifies a set of attribute/value pairs with meaning as
  97.       * defined by a 'boopsi' object's class.
  98.       *
  99.       * This function does not provide enough context information or
  100.       * arbitration for boopsi gadgets which are attached to windows
  101.       * or requesters.  For those objects, use setGadgetAttributes:from:req:tags:
  102.       *
  103.       * The object does whatever it wants with the attributes you provide.
  104.       * The return value tends to be non-zero if the changes would require
  105.       * refreshing gadget imagery, if the object is a gadget.
  106.       "
  107.       ^ <primitive 238 9 anObject tagArray>
  108. |
  109.    setGadgetAttributes: gadObj from: winObj req: reqObj tags: tagArray
  110.       " Same as setAttributes:tags:, but provides context information and
  111.       * arbitration for classes which implement custom Intuition gadgets.
  112.       *
  113.       * You should use this function for boopsi gadget objects which have
  114.       * already been added to a requester or a window, or for 'models' which
  115.       * propagate information to gadget(s) already added.
  116.       *
  117.       * Typically, the gadgets will refresh their visuals to reflect
  118.       * changes to visible attributes, such as the value of a slider,
  119.       * the text in a string-type gadget, the selected state of a button.
  120.       *
  121.       * You can use this as a replacement for setAttributes:tags:, too,
  122.       * if you specify nil for the 'winObj' and 'reqObj' parameters.
  123.       *
  124.       * The return value tends to be non-zero if the changes would require
  125.       * refreshing gadget imagery, if the object is a gadget.
  126.       "
  127.       ^ <primitive 238 10 gadObj winObj reqObj tagArray>
  128. |
  129.    nextObject: fromObject 
  130.       " This function is for boopsi class implementors only.
  131.       *
  132.       * When you collect a set of boopsi objects on an Exec List
  133.       * structure by invoking their OM_ADDMEMBER method, you
  134.       * can (only) retrieve them by iterations of this method.
  135.       *
  136.       * Works even if you remove and dispose the returned list
  137.       * members in turn.
  138.       " 
  139.       ^ <primitive 238 11 fromObject>
  140. |
  141.    doGadgetMethod: gadObj from: winObj req: reqObj message: msgObj
  142.       " Same as the DoMethod() function of amiga.lib, but provides context
  143.       * information and arbitration for classes which implement custom
  144.       * Intuition gadgets.
  145.       * 
  146.       * You should use this method for boopsi gadget objects,
  147.       * or for 'models' which propagate information to gadgets.
  148.       *
  149.       * The object does whatever it wants with the message you sent,
  150.       * which might include updating its gadget visuals.
  151.       *
  152.       * The return value is defined per-method.
  153.       "
  154.       ^ <primitive 238 12 gadObj winObj reqObj msgObj>
  155. |      
  156.    translateBoopsiErrorNumber  
  157.       ^ <primitive 238 13>
  158. |
  159.    doSuperMethod: onObject message: msgObj
  160.       " Do NOT know if this is needed, but it is included to 
  161.       * complete the functionality of the Class:
  162.       "
  163.       ^ <primitive 238 14 iclassObj onObject msgObj>
  164. |
  165.    coerceMethod: onObject message: msgObj
  166.       " Do NOT know if this is needed, but it is included to 
  167.       * complete the functionality of the Class:
  168.       "
  169.       ^ <primitive 238 15 iclassObj onObject msgObj>
  170. ]
  171.  
  172.